package com.yubest.springboothello.controller;

import com.yubest.springboothello.interceptors.RequestStatInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 统计接口调用次数
 * @Author: hweiyu
 * @Date: 2023/6/2 11:07
 */
@RestController
@RequestMapping(value = "/stat")
public class StatController {

    @Autowired
    private RequestStatInterceptor requestStatInterceptor;

    @GetMapping(value = "/getCount")
    public Map<String, Long> getCount() {
        return requestStatInterceptor.getCounter();
    }
}
